package fr.umlv.m2.jee.portailEtudiant.service.Impl;

import fr.umlv.m2.jee.portailEtudiant.persistence.ITpDAO;
import fr.umlv.m2.jee.portailEtudiant.persistence.Tp;
import fr.umlv.m2.jee.portailEtudiant.service.DisplayTp;
import fr.umlv.m2.jee.portailEtudiant.service.IDisplayTpService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by IntelliJ IDEA.
 * User: soufiane
 * Date: 19/03/11
 * Time: 19:00
 * To change this template use File | Settings | File Templates.
 */
@Service("defaultDisplayTpService")
public class DefaultDisplayTpService implements IDisplayTpService {

    @Autowired
    @Qualifier("hibernateTpDAO")
    private ITpDAO tpDao;




    @Override
    public List< DisplayTp > getAllDisplayTps() {
        List< DisplayTp > result = new ArrayList<DisplayTp>();

        for(Tp tp : tpDao.findAll()) {
            result.add(new DisplayTp(tp));
        }
        return result;
    }
}
